package com.ctgu.tengyun.domain;

import com.ctgu.tengyun.exception.ConvertException;

public enum ProductStatus implements HasDefaultInterface<ProductStatus>{

    unknown(-1),
    normal(1),        //正常
    unused(2),        //停用
    ;

    private Integer value;

    ProductStatus(Integer value) {
        this.value = value;
    }

    @Override
    public ProductStatus getDefault() {
        return unknown;
    }

    @Override
    public Integer getValue() {
        return this.value;
    }

    public static ProductStatus valueOf(Integer value){
        for (ProductStatus item: ProductStatus.values()){
            if (item.getValue().equals(value)){
                return item;
            }
        }

        throw new ConvertException("unknown ProductStatus. status:" + value);
    }

}